The present invention relates to apparatus and method for generating Enterprise Java Beans (EJB) components by modeling them using the Unified Modeling Language (UML) and generating the Java source code from the UML models. The present technique utilizes a UML drawing tool, such as Rational Rose™, and creates an intermediate file that describes the EJB component model. The intermediate file is then transformed into the Java classes that make up one or more EJBs.
A component is a reusable software building block; a pre-built piece of encapsulated application code that can be combined with other components and with handwritten code to rapidly produce a custom application. Components execute within a construct called a container. A container provides an application context for one or more components and provides management and control services for the components. In practical terms, a container provides an operating system process or thread in which to execute the component. Client components normally execute within some type of visual container, such as a form, a compound document, or a Web page. Server components are non-visual and execute within a container that is provided by an application server, such as a Web server, or a database system.
A component model defines the basic architecture of a component, specifying the structure of its interfaces and the mechanisms by which it interacts with its container and with other components. The component model provides guidelines to create and implement components that can work together to form a larger application. Application builders can combine components from different developers or different vendors to construct an application.
Components come in a variety of shapes and sizes. A component can be very small, such as a simple GUI widget (e.g., a button), or it can implement a complex application service, such as an account management function.
In order to qualify as a component, the application code must provide a standard interface that enables other parts of the application to invoke its functions and to access and manipulate the data within the component. The structure of the interface is defined by the component model.
An application developer should be able to make full use of the component without requiring access to its source code. Components can be customized to suite the specific requirements of an application through a set of external property values. For example, the button component has a property that specifies the name that should appear on the button. The account management component has a property that specifies the location of the account database. Properties can be used to support powerful customization services. For example, the account management component might allow a user to add a special approval process for withdrawals over a certain dollar amount. One property would be used to indicate that special approval functions are enabled, a second property would identify the conditions that require special approvals, and a third property would indicate the name of the approval process component that should be called when the condition exists.
The JavaBeans component model defines a standard mechanism to develop portable, reusable Java technology development components, such as widgets or controls. A JavaBeans component (a Bean) is a specialized Java class that can be added to an application development project and then manipulated by the Java development tool. A bean provides special hooks that allow a visual Java development tool to examine and customize the contents and behavior of the bean without requiring access to the source code. Multiple beans can be combined and interrelated to build Java applets or applications or to create new, more comprehensive, or specialized JavaBeans components.
The Enterprise JavaBeans components model logically extends the JavaBeans component model to support server components. Server components are reusable, prepackaged pieces of application functionality that are designed to run in an application server. They can be combined with other components to create customized application systems. Server components are similar to development components, but they are generally larger grained and more complete that development components. Enterprise JavaBeans components (Enterprise Beans) cannot be manipulated by a visual Java development tool in the same way that JavaBeans components can. Instead, they can be assembled and customized at deployment time using tools provided by an EJB-compliant Java application server.
The Enterprise JavaBeans architecture provides an integrated application framework that dramatically simplifies the process of developing enterprise-class application systems. An EJB server automatically manages a number of tricky middleware services on behalf of the application components. EJB component-builders can concentrate on writing business logic rather than complex middleware. The results are that applications get developed more quickly and the code is of better quality.
Code generation from UML has not been widely pursued for a number of reasons: the generated code has been viewed as being inferior; no easy way to generate the implementation of the business logic; lack of round trip engineering support (i.e., no iterative development cycle), which means that presently available tools can only be used to generate the first attempt at the classes, i.e., no mechanism or provision for upgrades, revisions, etc.; and the problem of synchronizing the model and code, thereby diminishing the value or usefulness of the model.